Skip to content

[Service-Client] H2 Pool integation and usage in service client#4493

Open
muhamadazmy wants to merge 3 commits intorestatedev:mainfrom
muhamadazmy:pr4493
Open

[Service-Client] H2 Pool integation and usage in service client#4493
muhamadazmy wants to merge 3 commits intorestatedev:mainfrom
muhamadazmy:pr4493

Conversation

@muhamadazmy
Copy link
Copy Markdown
Contributor

@muhamadazmy muhamadazmy commented Mar 16, 2026

[Service-Client] H2 Pool integation and usage in service client

  • This PR finally enable using of the new H2 pool in the http service client.

Fixes #4451


Stack created with Sapling. Best reviewed with ReviewStack.

@muhamadazmy muhamadazmy force-pushed the pr4493 branch 4 times, most recently from eb9b4ca to a7b78b3 Compare March 17, 2026 14:25
@muhamadazmy muhamadazmy changed the title [service-client] H2 Pool integaation in service client [service-client] H2 Pool integation and usage in service client Mar 17, 2026
@muhamadazmy muhamadazmy marked this pull request as ready for review March 17, 2026 14:41
@claude
Copy link
Copy Markdown

claude bot commented Mar 17, 2026

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@muhamadazmy muhamadazmy force-pushed the pr4493 branch 2 times, most recently from 01461e0 to 5857bf0 Compare March 18, 2026 09:51
@muhamadazmy muhamadazmy changed the title [service-client] H2 Pool integation and usage in service client [Service-Client] H2 Pool integation and usage in service client Mar 18, 2026
@muhamadazmy muhamadazmy mentioned this pull request Mar 18, 2026
@muhamadazmy muhamadazmy force-pushed the pr4493 branch 6 times, most recently from 71da9b7 to 2e8b9fc Compare March 19, 2026 16:10
Copy link
Copy Markdown
Contributor

@tillrohrmann tillrohrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for integrating the connection pool into the HttpClient @muhamadazmy. I left a few minor comments. Did you run any benchmarks to see whether the new connection pool has any performance implications?

Comment on lines +500 to 503
//todo: this is a temp clone to test
Self::WaitingHeaders {
join_handle: AbortOnDropHandle::new(tokio::task::spawn(client.call(req))),
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are we testing here? Should this become part of main if it's for testing?

Comment on lines 75 to 77
/// Client when HTTP2 was specifically requested - for cleartext, we use h2c,
/// and for HTTPS, we will fail unless the ALPN supports h2.
/// In practice, at discovery time we never force h2 for HTTPS.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment seems off.

/// type complexity for higher layer
#[pin_project::pin_project]
pub struct ResponseBody {
#[pin]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is pin needed here? Is Incoming !Unpin?

/// **NOTE**: Setting this value to None (default) users the default
/// recommended value from HTTP2 specs
pub initial_max_send_streams: Option<usize>,
pub initial_max_send_streams: Option<u32>,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Some(0) a valid value here?

/// If the ping is not acknowledged within the timeout, the connection will
/// be closed.
///
/// Only meaningful when `keep_alive_interval` is `Some`. Defaults to 20 s.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is keep_alive_interval referring to?

@muhamadazmy muhamadazmy force-pushed the pr4493 branch 2 times, most recently from 44dd0bf to 3862f24 Compare March 30, 2026 15:37
@muhamadazmy muhamadazmy force-pushed the pr4493 branch 2 times, most recently from e49e78d to 43b08ad Compare March 30, 2026 16:07
## Summary
- Introduce Connection<C>, a Tower Service-based HTTP/2 connection that multiplexes requests over a single H2 session with semaphore-backed concurrency control
- Add TcpConnector service and ConnectionInfo/IntoConnectionInfo abstractions for URI-based TCP connection establishment
## Summary
- Add AuthorityPool<C> that manages multiple H2 connections to a single authority (scheme+host+port), creating connections on demand when streams are exhausted and evicting failed ones
- Add Pool<C> that routes requests to the correct AuthorityPool via a DashMap<ConnectionInfo, AuthorityPool<C>>
- Add PoolBuilder with configurable max_connections and init_max_streams per authority
- This PR finally enable using of the new H2 pool in the http service client.

Fixes restatedev#4451
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for connection pooling

2 participants